package entities;

import backbone.IUpdatable;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import main.Simulation;


/**
 * When a click is registered on the simulation canvas,
 * this type of PointObject is created at the location 
 * of the click. 
 * 
 * @author Paul
 * @author Lance
 */
public class MousePoint extends PointObject implements IUpdatable {

    private static final int MOUSEPOINT_ID = -1;
    
    /**
     * Creates the object.
     * @param x The x coordinate that the point should first appear.
     * @param y Thy y coordinate that the point should first appear.
     */
    public MousePoint(double x, double y) {
        super(MOUSEPOINT_ID, x, y);
    }

    @Override
    public void paint(Graphics2D pen) {
        pen.setColor(Color.YELLOW);
        pen.fillOval(getLeft(), getTop(), getSize().width, getSize().height);
    }

    @Override
    public void update(Simulation canvas, double dt) {
        Point mousePosition = canvas.getLastMousePosition();
        getCenter().setLocation(mousePosition);
    }
}
